<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/jsp/base.jsp" %>

  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>系统图标</title> 
    <base href="${__base}"/>
    <link href="styles/liger/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <link href="styles/liger/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
    <script src="styles/liger/jquery/jquery-1.5.2.min.js" type="text/javascript"></script>
    <script src="styles/liger/ligerUI/js/ligerui.min.js" type="text/javascript"></script>   
    <link href="styles/liger/css/common.css" rel="stylesheet" type="text/css" />  
    <script src="styles/liger/js/common.js" type="text/javascript"></script>   
    <script src="styles/liger/js/LG.js" type="text/javascript"></script>
    <script src="styles/liger/js/ligerui.expand.js" type="text/javascript"></script> 
    <script src="styles/liger/json2.js" type="text/javascript"></script>
</head>
<body style="padding:10px;height:100%; text-align:center;">
   <ipnut type="hidden" id="MenuNo" value="OrderManageShippers" />

  <div id="maingrid"></div> 
  <script type="text/javascript">
      //相对路径
      var rootPath = "sys/icon!json.shtml?operatingLeve=1";
      //列表结构
      var grid = $("#maingrid").ligerGrid({ 
          columns: [{display:"图片",name:"operatingIco",width:180,type:"img",align:"left"},
          {display:"名称",name:"operatingName",width:180,type:"text",align:"left"},
          {display:"权限",name:"operatingLeve",width:180,type:"text",align:"left"},
          {display:"地址",name:"operatingIco",width:180,type:"text",align:"left"},
          {display:"描述",name:"operatingDesc",width:280,type:"text",align:"left"}
          
          ], dataAction: 'server', pageSize: 20, toolbar: {},
          url: rootPath , operatingLeve: 1, 
          width: '98%', height: '100%',heightDiff:-10, checkbox: false
      });

      //双击事件
      LG.setGridDoubleClick(grid, 'modify');

      //搜索表单应用ligerui样式
      $("#formsearch").ligerForm({
		   fields:[{display:"公司名",name:"CompanyName",newline:false,labelWidth:100,width:520,space:30,type:"text",cssClass:"field"}],
		   toJSON: JSON2.stringify
	  });


      //加载toolbar
      LG.loadToolbar(grid, toolbarBtnItemClick);
      
      //工具条事件
      function toolbarBtnItemClick(item) {
     
          switch (item.id) {
              case "add":
                  top.f_addTab(null, '增加托运人信息', 'OrderManage/ShippersDetail.aspx');
                  break;
              case "view":
                  var selected = grid.getSelected();
                  if (!selected) { LG.tip('请选择行!'); return }
                  top.f_addTab(null, '查看托运人信息', 'OrderManage/ShippersDetail.aspx?IsView=1&ID=' + selected.ShipperID);
                  break;
              case "modify":
                  var selected = grid.getSelected();
                  if (!selected) { LG.tip('请选择行!'); return }
                  top.f_addTab(null, '修改托运人信息', 'OrderManage/ShippersDetail.aspx?ID=' + selected.ShipperID);
                  break;
              case "delete":
                  jQuery.ligerDialog.confirm('确定删除吗?', function (confirm) {
                      if (confirm)
                          f_delete();
                  });
                  break;
          }
      }
      function f_reload() {
          grid.loadData();
      }
      function f_delete() {
          var selected = grid.getSelected();
          if (selected) {
              LG.ajax({
                  type: 'AjaxOrderManage',
                  method: 'RemoveShippers',
                  loading: '正在删除中...',
                  data: { ID: selected.ShipperID },
                  success: function () {
                      LG.showSuccess('删除成功');
                      f_reload();
                  },
                  error: function (message) {
                      LG.showError(message);
                  }
              });
          }
          else {
              LG.tip('请选择行!');
          }
      }
  </script>
</body>
</html>
